﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="report.aspx.cs" EnableEventValidation="false" Inherits="member_report" %>

<link rel="stylesheet" href="https://cdn.bootcss.com/chosen/1.5.1/chosen.min.css" />
<link rel="stylesheet" href="/Public/Home/css/colorbox.css" />
<style type="text/css">
.QiyeC a{border:1px solid #d2ccc4;color:#666;padding: 3px 10px;display:inline-block;margin:5px 0;}
.alert-warning{
	position:relative;
	margin:0 30px 15px;
	padding:25px;
	color:#a94442;
	background-color:#f2dede;
	border:1px solid #ebccd1;
	border-radius:4px;
}
.alert-warning .close{
	position:absolute;
	top:25px;
	right:25px;
}
</style>
<div class="Member_content">
	<h1 class="member_iconTit">
    	检验报告管理
    </h1>
    <h2 class="jies">说明：
    <br />1、文件上传、扫描上传、拍照上传支持所有浏览器，拍照上传推荐使用firefox、chrome、360极速等支持HTM5的浏览器。
    <br />2、点击档案号可直接修改。
    <br />3、采购单据号和销售单据号不能同时查询
    <br />4、为了保证报告的存储质量，请上传1240*1754及以上分辨率的图片
    </h2>
        <div class="msearch" style="height:100px;">
            <form id="from1" runat="server">
            <input type="hidden" name="export" id="export" value="0" />
        	<span class="s1">
				<b>出入库单据号</b>
                <asp:TextBox ID="dj" runat="server" style="width:173px;" placeholder="请输入单据号"></asp:TextBox>
			</span>
			<span class="s1">
				<b>药品批号</b>
                <asp:TextBox ID="ph" runat="server" style="width:120px;" placeholder="请输入药品批号"></asp:TextBox>
			</span>
			<span class="s1">
				<b>供货商</b>
                <asp:TextBox ID="gh" runat="server" style="width:120px;" placeholder="请输入供货商"></asp:TextBox>
			</span>
			<div style="width:100%;float:left;padding:8px 0;margin:0;height:0;"></div>	
			<span class="s1">
				<b>入库时间</b>				
                <asp:TextBox ID="srq" runat="server" style="width:74px;" onFocus="WdatePicker()" placeholder="开始时间"></asp:TextBox>
				<span style="line-height:30px;margin:0;"> - </span>				
                <asp:TextBox ID="erq" runat="server" style="width:74px;" onFocus="WdatePicker()" placeholder="结束时间"></asp:TextBox>
			</span>
			<span class="s1">
				<b>其他信息</b>
                <asp:TextBox ID="k" runat="server" style="width:120px;" placeholder="编号/名称/拼音码/厂家名称"></asp:TextBox>

			</span>
			<span class="s1">
				<b>上传状态</b>
                <asp:dropdownlist CssClass="listbox" ID="ddlfstate" runat="server">
                        <asp:ListItem>全部</asp:ListItem>
                </asp:dropdownlist>
			</span>
            <asp:Button ID="Submit" CssClass="msbut submit-search" runat="server" Text="搜索" onclick="Submit_Click" />
    </div>
    <div class="mbig">
        <asp:literal ID="ResultDeBug" runat="server"></asp:literal>
        <asp:literal ID="msg" runat="server"></asp:literal>         
              <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" GridLines="None" Width="100%" CellPadding="0" CssClass="sebig" AllowPaging="true"  onpageindexchanging="GridView1_PageIndexChanging" >
                        <Columns>
                            <asp:BoundField DataField="spid" HeaderText="spid" ReadOnly="True" Visible="false" />
                            <asp:BoundField DataField="spid" HeaderText="药品ID" ReadOnly="True" HeaderStyle-Width="8%"/>
                            <asp:BoundField DataField="bh" HeaderText="档案号" HeaderStyle-Width="5%"/>
                            <asp:BoundField DataField="spbh" HeaderText="编号" HeaderStyle-Width=""  />
                            <asp:BoundField DataField="spmch" HeaderText="名称" HeaderStyle-Width=""/>                            
                            <asp:BoundField DataField="shpgg" HeaderText="规格" HeaderStyle-Width="8%"/>
                            <asp:BoundField DataField="dw" HeaderText="单位" HeaderStyle-Width="3%"/>
                            <asp:BoundField DataField="shengccj" HeaderText="生产厂家" HeaderStyle-Width=""/>
                            <asp:BoundField DataField="pihao" HeaderText="批次号" HeaderStyle-Width="5%"/>
                            <asp:BoundField DataField="rq" HeaderText="最后入出库时间" HeaderStyle-Width="150"/>
                            <asp:TemplateField HeaderText="检验报告" HeaderStyle-Width="15%" ItemStyle-CssClass="QiyeC">
                            <ItemTemplate>
                            <%# Eval("url") %>
                            </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <RowStyle CssClass="searli" />
                        <HeaderStyle CssClass="setit" />

                    <PagerTemplate>
                        <div class="bot">
				        <h1 class="fl s2">&nbsp;</h1>
	        <ul class="fr s2"><li class="pageList"><asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev"
                                        CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'>上一页</asp:LinkButton> 
                <asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page"
                                        Visible='<%#((GridView)Container.NamingContainer).PageIndex != 0 %>'>首页</asp:LinkButton>                 
                <asp:TextBox ID="TextBox1" runat="server" Width="20px" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' style="float:left;width:40px;height:30px;line-height:30px;border:1px solid #e5e5e5;text-align:center;margin:0 -1px 0 3px;" />
                <input type="submit" style="height:32px;line-height:32px;float:left;width:40px;" value="跳转" /> 
                <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument="Last" CommandName="Page"
                                        Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>尾页</asp:LinkButton> 
                <asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page"
                                        Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>下一页</asp:LinkButton> 
                <a href="javascript:;">共 <%=recordCount %> 条记录，本页有 <%# ((GridView)Container.NamingContainer).Rows.Count%> 条记录，
                    第 <asp:Literal ID="LabelCurrentPage" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Literal>/<asp:Literal ID="LabelPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount%>"></asp:Literal> 页</a></li></ul>
	    </div>

                                    
                                </PagerTemplate>
                    </asp:GridView>
       </form>

  </div>
</div>
<script src="https://cdn.bootcss.com/chosen/1.5.1/chosen.jquery.js" type="text/javascript"></script>
<script src="/Public/Home/js/jquery.colorbox.js" type="text/javascript"></script>
<script src="/Public/Home/js/jqueryui.js" type="text/javascript"></script>
<script src="/Public/Home/js/jquery.mousewheel.min.js" type="text/javascript"></script>
<script src="/Public/Home/js/jquery.iviewer.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/Public/Home/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $(function () {
        $('#search-from').keyup(function (event) {
            if (event.keyCode == 13) {
                $('#export').val('0');
                $('#search-from').submit();
            }
        }).on('click', '.submit-search', function () {
            $('#export').val($(this).attr('data-type'));
            $('#search-from').submit();
        });
        $('select').chosen({ disable_search: true, width: '132px' });
        $('.view').colorbox({ width: '80%', height: '100%', current: "{current}/{total}" });
        $(document).bind('cbox_complete', function () {
            var image_id = $.colorbox.element().attr('rel');
            var image_url = $.colorbox.element().attr('href');
            var data_img = $.colorbox.element().attr('data-img');
            $("#cboxLoadedContent").iviewer({
                src: image_url, onFinishLoad: function () {
                    $(this).append('<div class="iviewer_common iviewer_button btn-image-delete" data-id="' + image_id + '"  data_img="' + data_img + '"  data-url="' + image_url + '">删除该张报告</div>');
                }
            }).find('img.cboxPhoto').remove();
        });
        $('#colorbox').on('click', '.btn-image-delete', function () {
            var image_id = $(this).attr('data_img');
            if (confirm("确定要删除该报告图片吗？")) {
                $.ajax({
                    url: '/member/delfile.ashx',
                    type: "post",
                    data: { image_id: image_id },
                    dataType: 'json',
                    success: function (data) {
                        alert(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！');
                        if (data.code == 1) {
                            window.location.reload();
                        }
                        return false;
                    },
                    error: function () {
                        alert('抱歉，系统错误，请稍后再试！');
                    }
                });
            }
            return false;
        });
        $(".upload").on('click', function () {
            var title, url, $obj = $(this);
            var id = $obj.attr('data-id');
            var batch = $obj.attr('data-batch');
            var url = '/base/reportupload.aspx';
            $.dialog({
                title: '检验报告扫描上传',
                width: 965,
                height: 533,
                content: 'url:' + url + '?id=' + id + '&batch=' + batch + '&fstate=<%=fstate%>&djbh=<%=djbh%>&pihao=<%=pihao%>&ghs=<%=ghs%>&crksrq=<%=crksrq%>&crkerq=<%=crkerq%>&keyword=<%=keyword%>',
                padding: 0,
                lock: true,
                fixed: true,
                min: false,
                max: false,
                close: function () {
                    if (this.iframe.contentWindow.dcsObject) {
                        this.iframe.contentWindow.dcsObject.destroy();
                    }
                }
            });
            return false;
        });
        $(".uploadfile").on('click', function () {
            var title, url, $obj = $(this);
            var id = $obj.attr('data-id');
            var width = 1000;
            var height = 546;
            if ($obj.attr('data-type') == 'file') {
                title = '检验报告文件上传';
                url = '/base/quickupload/type/batch.html';
                width = 630;
                height = 270;

                $.dialog({
                    title: title,
                    width: width,
                    height: height,
                    content: 'url:' + url + '?id=' + id,
                    padding: 0,
                    lock: true,
                    fixed: true,
                    min: false,
                    max: false
                });
                return false;
            }
        });
        $('.number').on('click', function () {
            var value = $(this).text();
            var id = $(this).attr('data-id');
            $.dialog.prompt('请输入新的档案号：',
                function (val) {
                    if (val.length == 0) {
                        return false;
                    }
                    if (val == value) {
                        return false;
                    }
                    $.ajax({
                        url: '/member/batch/act/number.html',
                        type: "post",
                        data: { number: val, id: id },
                        dataType: 'json',
                        success: function (data) {
                            if (data.code == 1) {
                                $.dialog.tips(data.msg, 1, 'success.gif', function () {
                                    window.location.reload();
                                });
                            } else {
                                $.dialog.tips(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                                return false;
                            }
                        },
                        error: function () {
                            $.dialog.tips('抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                        }
                    });
                },
                value
            );
            return false;
        });
        $('.reminder').on('click', function () {
            var id = $(this).attr('data-id');
            $.ajax({
                url: '/member/batch/act/reminder.html',
                type: "post",
                data: { id: id },
                dataType: 'json',
                success: function (data) {
                    if (data.code == 1) {
                        $.dialog.tips(data.msg, 1, 'success.gif', function () {
                            window.location.reload();
                        });
                    } else {
                        $.dialog.tips(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                        return false;
                    }
                },
                error: function () {
                    $.dialog.tips('抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                }
            });
            return false;
        });

        $('.jybg').on('click', function () {
            $.dialog.tips('数据加载中...', 1000, 'loading.gif');
            $.ajax({
                url: '/search/jianyanbg.html',
                dataType: 'json',
                success: function (data) {
                    if (data.code == 1) {
                        $.dialog.tips(data.msg, 1, 'success.gif', function () {
                            window.location.reload();
                        });
                    } else {
                        $.dialog.tips(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                        return false;
                    }
                },
                error: function () {
                    $.dialog.tips('抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                }
            });
            return false;
        });

        $('.alert-warning').on('click', 'a.close', function () {
            $(this).closest('div.alert-warning').remove();
            return false;
        });

        $(".check_all").click(function () {
            $(this).closest('table').find(".check_all").prop("checked", $(this).prop("checked"));
            $(this).closest('table').find(":checkbox[name='ids']").prop("checked", $(this).prop("checked"));
        });

        $(".delbatch").on('click', function () {
            var chk_value = [];
            $('input[name="ids"]:checked').each(function () {
                chk_value.push($(this).val());
            });
            if (confirm("确定要删除该吗？")) {
                $.ajax({
                    url: '/member/batch/act/delbt.html',
                    type: "post",
                    data: { chk_value: chk_value },
                    dataType: 'json',
                    success: function (data) {
                        alert(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！');
                        if (data.code == 1) {
                            window.location.reload();
                        }
                        return false;
                    },
                    error: function () {
                        alert('抱歉，系统错误，请稍后再试！');
                    }
                });
            }
        })


    });
</script>
<script type="text/javascript">
    $(document).ready(window.onresize = function () {
        //var whe = $(window).height();
        //$(".Member_left").css("height",whe-72);
        $('body').on('click', '.ajax-url', function () {
            var msg = '确定要执行该操作吗？';
            var url = $(this).attr('href');
            if ($(this).attr('data-msg')) {
                msg = $(this).attr('data-msg');
            }
            $.dialog.confirm(msg, function () {
                $.ajax({
                    url: url,
                    type: "post",
                    data: {},
                    dataType: 'json',
                    success: function (data) {
                        if (data.code == 1) {
                            $.dialog.tips(data.msg ? data.msg : '操作成功', 2, 'success.gif', function () {
                                window.location.reload();
                            });
                        } else {
                            $.dialog.tips(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                        }
                    },
                    error: function () {
                        $.dialog.tips('抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                    }
                });               
            });
            return false;
        });
        $('.logout').on('click', function () {
            var href = $(this).attr('href');
            $.dialog.confirm('您确定要退出登录吗？', function () {
                window.location.href = href;
            });
            return false;
        });
        if (!('placeholder' in document.createElement('input'))) {
            $('input[placeholder],textarea[placeholder]').each(function () {
                var that = $(this),
                text = that.attr('placeholder');
                if (that.val() === "") {
                    that.val(text).addClass('placeholder');
                }
                that.focus(function () {
                    if (that.val() === text) {
                        that.val("").removeClass('placeholder');
                    }
                })
                .blur(function () {
                    if (that.val() === "") {
                        that.val(text).addClass('placeholder');
                    }
                })
                .closest('form').submit(function () {
                    if (that.val() === text) {
                        that.val('');
                    }
                });
            });
        }
    });
</script>
</body>
</html>
